//
//  XWUserAccount.swift
//  新浪 weibo
//
//  Created by xuwei on 16/1/21.
//  Copyright © 2016年 xuwei. All rights reserved.
//

import UIKit

class XWUserAccount: NSObject,NSCoding {
// 用户在新浪微博的id
    var uid : String?
//过期时间
    var expires_in : Int = 0
    //access_token
    var access_token : String?
    //过期时间的字符串类型
    var remind_in : String?
    //用户的大图 180*180
    var avatar_large : String?
    //用户的昵称
    var screen_name : String?
    
    init(dict: [String : AnyObject]){
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    //归档
    func encodeWithCoder(encoder:NSCoder){
        encoder.encodeObject(uid, forKey: "uid")
        encoder.encodeObject(access_token, forKey: "access_token")
        encoder.encodeInteger(expires_in, forKey: "expires_in")
        encoder.encodeObject(avatar_large, forKey: "avatar_large")
        encoder.encodeObject(screen_name, forKey: "screen_name")
    }
    //解档
    required init(coder decoder:NSCoder){
        uid = decoder.decodeObjectForKey("uid") as? String
        access_token = decoder.decodeObjectForKey("access_token") as? String
        expires_in = decoder.decodeIntegerForKey("expirs_in")
        avatar_large = decoder.decodeObjectForKey("avatar_large") as? String
        screen_name = decoder.decodeObjectForKey("screen_name") as? String

        
        
        
    }
    
    
    
}
